<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	template="/WEB-INF/templates/default.xhtml">

	<ui:define name="menu">
		<ul>
			<li><h:link value="Home"  outcome="/index" /> </li>
			<li><h:link value="Users"  outcome="/content/user/list" /> </li>
			<li><h:link class="akt" value="Resources"  outcome="/content/resource/list" /> </li>
		    <li><h:link value="Tasks"  outcome="/content/task/list" /> </li> 
		    <li><h:link value="Task types"  outcome="/content/tasktype/list" /> </li>
		</ul>
		<p class="vonal"><br/></p>
	</ui:define>
	
	<ui:define name="content2">
		<h:form id="resourceListForm">

			<h:outputLabel for="username" value="User:   "
				style="margin-left:140px; color:red;" />
			<h:selectOneMenu converter="#{userBean.converter}" id="username"
				value="#{resourcesListBean.user}" 
				style="background-color:#F5FFFA; width: 150px;">
				<f:selectItems value="#{userListBean.loadAllUsers()}" var="user"
					itemValue="#{user}" itemLabel="#{user.name}" />
			</h:selectOneMenu>
			
			<h:commandButton action="#{resourcesListBean.searchActionByUser()}"
				value="Search"
				style="background-color:#F5FFFA; width: 100px;margin-left: 25px;" />
			
			<br/><br/>
			
			<h:dataTable id="resourceTable"
				value="#{resourcesListBean.resources}" var="res" 
				styleClass="resourceTable"
				columnClasses="resourceTableName, resourceTableType, resourceTableValue, resourceTableUser"
				rowClasses="userTableOddRow, userTableEvenRow">

 				<h:column headerClass="resourceTableHeaderName" >
					<f:facet name="header">Name</f:facet>
					<h:link outcome="/content/resource/edit" value="#{res.name}">
						<f:param name="id" value="#{res.id}" />
					</h:link>
				</h:column>

				<h:column headerClass="resourceTableHeaderType">
					<f:facet name="header">Type</f:facet>
					<h:outputText value="#{res.type}" />
				</h:column>

				<h:column headerClass="resourceTableHeaderValue">
					<f:facet name="header">Value</f:facet>
					<h:outputText value="#{res.value}" />
				</h:column>
				
				<h:column headerClass="resourceTableHeaderUser">
					<f:facet name="header">User</f:facet>
					<h:outputText value="#{res.task.user.name}" />
				</h:column>
			
			</h:dataTable>
			<br/>
			
		</h:form>

	</ui:define>
</ui:composition>
